Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

416
Views
React Testing Library: se esperaba que el elemento tuviera el atributo: aria-selected="true" Recibido: nulo

Tengo el cuadro de selección de reacción de MUI como se muestra a continuación.

 <MenuItem key={`${option.label}-${option.value}-${i}`} value={option.value}> {option.labelName}{option.labelDescription} </MenuItem>

que he actualizado como se muestra a continuación para agregar una clase para el estilo CSS

 <MenuItem key={`${option.label}-${option.value}-${i}`} value={option.value}> <span className={`${classes.name}`} data-testid="select-name">{option.labelName}</span> <span className={`${classes.description}`} data-testid="description">{option.labelDescription}</span> </MenuItem>

Tengo los casos de prueba de unidad que fallan después de agregar el span

 const nameOption = await findByText("John"); expect(nameOption).toBeInTheDocument(); await act(async () => { fireEvent.click(nameOption); }); expect(nameOption).toHaveAttribute("aria-selected", "true");

Recibo el siguiente error después de agregar el span

 'Expected the element to have attribute: aria-selected="true" Received:null'

¿Alguien puede ayudarme a solucionar este problema?

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!